module access_rules


access control rules
	principal is User with credentials name, pass
	
	rule template topmenu() { true }
	rule template topmenu_shortcuts() { loggedIn }
	
	rule template main(wiki: SocBMWiki){ true }
	rule template templateargument*(*) { true }
	rule page editwiki(wiki: SocBMWiki){ securityContext.principal in wiki.editors }
	rule page root() { true }
	rule page register() { true }
	// called from inside root() and users()
	rule page homepage(*) { true }
		
	// called from listtagentry()
	rule page tagentry_references(*) { true }

	// links navigated by the top menu
	rule page signoff() { loggedIn }
	rule page signin()  { !loggedIn }
	rule page bookmarks(*) { true }
	rule page tags() { true }
	rule page users() { true }
	

	// called from tags()
	rule template listtag(*) { true }
	rule template tags_listtag(*) { true }
	// called from listtag()
	rule page tag_references(*) { true }

	// called from bookmarks()
	rule template bookmarks_listbookmark(bm: Bookmark) { true }
	
	// called from homepage(), bookmarks, bookmark_referneces()
	rule template listbookmark(bm: Bookmark, bmentry: BookmarkEntry) {
	  true
	  rule action delete() {
	    (bmentry != null) && (bmentry.user == principal)
	  }
	}
	// called from listbookmark()
	rule page bookmark_references(*) { true }
	
	// called from inside top menu shortcuts
	rule template bookmarkentry_create_box() { loggedIn }
	
	// links navigated by the top menu shortcuts
	rule page bookmarkentry_create(*) { loggedIn }
	rule page bookmarkentry_edit(bmentry: BookmarkEntry) { bmentry.user == principal }